<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/resources/modular/plugin/taglibs.jsp" %>
<!doctype html>
<head content="-费率管理">
    <%@ include file="/resources/modular/head/inside_factory_head.jsp" %>
</head>
<body class="GC_Menu_3" name="GC_usermanager">
<%@ include file="/resources/modular/plugin/mainFactoryMenu.jsp" %>
<div class="loading"></div>
<div class="page" name="GC_ratemanager">

    <%@ include file="/resources/modular/plugin/mainFactoryTopMenu.jsp" %>
    <%@ include file="/resources/modular/plugin/usersmanageMeun.jsp" %>
    <div class="page_line"></div>

    <div class="page_right userspage_right">
        <ul class="users_rightTitle">
            <%--<li>用户号</li>--%>
            <li>用户名</li>
            <li>商户号</li>
            <li>手机号</li>
            <li>创建时间</li>
            <li>费率</li>
            <li>操作</li>
        </ul>

        <c:forEach items="${userbusiness}" var="info" varStatus="status">
            <ul class="users_rightList">
                <%--<li>${info.userno}</li>--%>
                <li>${info.userName}</li>
                <li>${info.businessNumber}</li>
                <li>${info.userMobile}</li>
                <li>${info.createTime}</li>
                <li class="users_rightRate">${info.rate}</li>
                <li>
                    <a class="users_rightRatebtn" href="javascript:;">费率编辑</a>
                    <div class="users_rightRate_dv">
                        <input class="users_rightRate_val" type="text" value="${info.rate}">
                        <a class="users_rightRate_dvbtn1" href="javascript:;" oldrate="${info.rate}" businessid="${info.id}">确认</a>
                        <a class="users_rightRate_dvbtn2" href="javascript:;">取消</a>
                    </div>
                </li>
            </ul>
        </c:forEach>


    </div>
</div>

</body>
</html>
<%@ include file="/resources/modular/foot/inside_factory_footer.jsp" %>
<script type="application/javascript">

    $(".users_rightRate_dvbtn1").click(function(){
        var businssid = $(this).attr("businessid");
        var rate = $(this).prev().val();
        if(typeof(rate) == "undefined" || rate.length <= 0){
            alert("费率不能为空");
            $(this).prev().val($(this).attr("oldrate"));
        }else if($(this).attr("oldrate") == rate){
            alert("费率值没有改变，不可提交");
        }else{
            $.ajax({
                url: '${basePath}v2/factory/individual/editrate',
                type: 'POST',
                data: {
                    "userbusinssid" : businssid,
                    "rate":rate
                },
                error: function (response) {
                    $errorMsg(response);
                },
                success: function (ret) {
                    if (ret.result) {
                        alert("编辑用户费率成功","cur");
                    } else {
                        alert(ret.info);
                    }
                }
            });



        }
    })

</script>